package com.example.websocket.pattern.structural.adapter;

public class MediaAdapter implements MediaPlayer {

    private AdvancedMediaPlayer advancedMediaPlayer;

    public MediaAdapter(String playType) {
        if (playType.equalsIgnoreCase("vlc")){
            advancedMediaPlayer = new VlcPlayer();
        } else if (playType.equalsIgnoreCase("mp4")){
            advancedMediaPlayer = new Mp4Player();
        }
    }

    @Override
    public void play(String playType, String fileName) {
        if (playType.equalsIgnoreCase("vlc")){
            advancedMediaPlayer.playVlc();
        } else if (playType.equalsIgnoreCase("mp4")){
            advancedMediaPlayer.playMp4();
        }
    }
}
